{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "913f560f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/tokenizers-0.14.1-py3.11-macosx-12-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/urllib3-1.26.17-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sympy-1.12-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/google_auth-2.23.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/myst_parser-0.19.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/MarkupSafe-2.1.3-py3.11-macosx-12-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/tqdm-4.62.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/protobuf-3.20.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/click-8.1.7-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_serializinghtml-1.1.9-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/mdit_py_plugins-0.3.5-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/prompt_toolkit-3.0.39-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinx_autodoc_typehints-1.10.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_jsmath-1.0.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/huggingface_hub-0.17.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/imagesize-1.4.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/stack_data-0.6.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/attrs-20.2.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/hydra_core-1.3.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/networkx-3.2rc0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/Pygments-2.16.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/Babel-2.13.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_htmlhelp-2.0.4-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_jquery-4.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_devhelp-1.0.5-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/fuzzywuzzy-0.18.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/fairscale-0.4.13-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/alabaster-0.7.13-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/iopath-0.1.10-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/Sphinx-5.1.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_applehelp-1.0.7-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/backcall-0.2.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/ptyprocess-0.7.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/py_rouge-1.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/GitPython-3.1.37-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/pickleshare-0.7.5-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/snowballstemmer-2.2.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/matplotlib_inline-0.1.6-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/Pillow-10.0.1-py3.11-macosx-12-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/markdown_it_py-2.2.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/pytest_datadir-1.5.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/textsearch-0.0.24-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/numpy-1.23.5-py3.11-macosx-12-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/pluggy-1.3.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/googleapis_common_protos-1.60.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/fsspec-2022.2.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/tensorboardX-2.5-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/ninja-1.10.2.4-py3.11-macosx-12-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/antlr4_python3_runtime-4.9.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/decorator-5.1.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/jedi-0.19.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/docutils-0.15.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/contractions-0.1.73-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/sphinxcontrib_qthelp-1.0.6-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/appnope-0.1.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/tomli-2.0.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/traitlets-5.11.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/mock-5.1.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/Markdown-3.3.2-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/datasets-2.2.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/iniconfig-2.0.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/google_api_core-2.11.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/regex-2023.10.3-py3.11-macosx-12-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/docformatter-1.4-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n",
      "\u001b[0m\u001b[33mDEPRECATION: Loading egg at /opt/homebrew/lib/python3.11/site-packages/openai-0.27.7-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330\u001b[0m\u001b[33m\r\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[0mCollecting seaborn\n",
      "  Downloading seaborn-0.13.2-py3-none-any.whl.metadata (5.4 kB)\n",
      "Requirement already satisfied: numpy!=1.24.0,>=1.20 in /opt/homebrew/lib/python3.11/site-packages/numpy-1.23.5-py3.11-macosx-12-arm64.egg (from seaborn) (1.23.5)\n",
      "Requirement already satisfied: pandas>=1.2 in /opt/homebrew/lib/python3.11/site-packages (from seaborn) (1.4.0)\n",
      "Requirement already satisfied: matplotlib!=3.6.1,>=3.4 in /opt/homebrew/lib/python3.11/site-packages (from seaborn) (3.8.0)\n",
      "Requirement already satisfied: contourpy>=1.0.1 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.1.1)\n",
      "Requirement already satisfied: cycler>=0.10 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (0.12.1)\n",
      "Requirement already satisfied: fonttools>=4.22.0 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (4.43.1)\n",
      "Requirement already satisfied: kiwisolver>=1.0.1 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (1.4.5)\n",
      "Requirement already satisfied: packaging>=20.0 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (23.2)\n",
      "Requirement already satisfied: pillow>=6.2.0 in /opt/homebrew/lib/python3.11/site-packages/Pillow-10.0.1-py3.11-macosx-12-arm64.egg (from matplotlib!=3.6.1,>=3.4->seaborn) (10.0.1)\n",
      "Requirement already satisfied: pyparsing>=2.3.1 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (2.4.7)\n",
      "Requirement already satisfied: python-dateutil>=2.7 in /opt/homebrew/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.4->seaborn) (2.8.2)\n",
      "Requirement already satisfied: pytz>=2020.1 in /opt/homebrew/lib/python3.11/site-packages (from pandas>=1.2->seaborn) (2023.3.post1)\n",
      "Requirement already satisfied: six>=1.5 in /opt/homebrew/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.4->seaborn) (1.16.0)\n",
      "Downloading seaborn-0.13.2-py3-none-any.whl (294 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m294.9/294.9 kB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: seaborn\n",
      "Successfully installed seaborn-0.13.2\n",
      "\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython3.11 -m pip install --upgrade pip\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pip3 install seaborn\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "a076b829",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score\n",
    "from sklearn.metrics import classification_report\n",
    "from sklearn.preprocessing import MinMaxScaler, StandardScaler,LabelEncoder\n",
    "from sklearn.decomposition import PCA\n",
    "import sqlite3\n",
    "from prophet import Prophet\n",
    "from prophet.plot import add_changepoints_to_plot\n",
    "import datetime as dt\n",
    "from sklearn import linear_model\n",
    "import xgboost as xgb\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from imblearn.over_sampling import SMOTE\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import logging\n",
    "import warnings\n",
    "import json\n",
    "%matplotlib inline\n",
    "warnings.filterwarnings('ignore')\n",
    "pd.set_option('display.max_rows', None)\n",
    "pd.set_option('display.max_columns', 500)\n",
    "pd.set_option('display.width', 1000)\n",
    "logger = logging.getLogger()\n",
    "logger.setLevel(logging.CRITICAL)\n",
    "import openai\n",
    "import pandas as pd\n",
    "import sqlite3\n",
    "from openai.api_resources.completion import Completion"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "59743940",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Connect to the sqlite db file and retrieve data as Pandas data frame.\n",
    "cnx = sqlite3.connect('FPA_FOD_20170508.sqlite')\n",
    "sql = \"select * from fires\"\n",
    "df = pd.read_sql_query(sql, cnx)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "36af8a8e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"Index(['OBJECTID', 'FOD_ID', 'FPA_ID', 'SOURCE_SYSTEM_TYPE', 'SOURCE_SYSTEM', 'NWCG_REPORTING_AGENCY', 'NWCG_REPORTING_UNIT_ID', 'NWCG_REPORTING_UNIT_NAME', 'SOURCE_REPORTING_UNIT', 'SOURCE_REPORTING_UNIT_NAME', 'LOCAL_FIRE_REPORT_ID', 'LOCAL_INCIDENT_ID', 'FIRE_CODE', 'FIRE_NAME', 'ICS_209_INCIDENT_NUMBER', 'ICS_209_NAME', 'MTBS_ID', 'MTBS_FIRE_NAME', 'COMPLEX_NAME', 'FIRE_YEAR', 'DISCOVERY_DATE', 'DISCOVERY_DOY', 'DISCOVERY_TIME', 'STAT_CAUSE_CODE', 'STAT_CAUSE_DESCR', 'CONT_DATE', 'CONT_DOY', 'CONT_TIME', 'FIRE_SIZE', 'FIRE_SIZE_CLASS', 'LATITUDE', 'LONGITUDE', 'OWNER_CODE', 'OWNER_DESCR', 'STATE', 'COUNTY', 'FIPS_CODE', 'FIPS_NAME', 'Shape'], dtype='object')\""
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()\n",
    "str(df.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "eef6ee43",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FIRE_YEAR                0\n",
       "DISCOVERY_DOY            0\n",
       "DISCOVERY_TIME      882638\n",
       "CONT_DOY            891531\n",
       "CONT_TIME           972173\n",
       "STAT_CAUSE_CODE          0\n",
       "STAT_CAUSE_DESCR         0\n",
       "FIRE_SIZE                0\n",
       "LATITUDE                 0\n",
       "LONGITUDE                0\n",
       "STATE                    0\n",
       "COUNTY              678148\n",
       "FIPS_NAME           678148\n",
       "DISCOVERY_DATE           0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_interest = df[[\"FIRE_YEAR\",\"DISCOVERY_DOY\",\"DISCOVERY_TIME\",\"CONT_DOY\",\"CONT_TIME\",\"STAT_CAUSE_CODE\",\"STAT_CAUSE_DESCR\",\"FIRE_SIZE\",\"LATITUDE\",\"LONGITUDE\",\"STATE\",\"COUNTY\",\"FIPS_NAME\",\"DISCOVERY_DATE\"]]\n",
    "df_interest.isna().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "52f883f7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of removed duplicate rows: 3525\n"
     ]
    }
   ],
   "source": [
    "print(f\"Number of removed duplicate rows: {df_interest.duplicated().sum()}\")\n",
    "df_interest = df_interest.drop_duplicates()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "bf158feb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FIRE_YEAR</th>\n",
       "      <th>DISCOVERY_DOY</th>\n",
       "      <th>DISCOVERY_TIME</th>\n",
       "      <th>CONT_DOY</th>\n",
       "      <th>CONT_TIME</th>\n",
       "      <th>STAT_CAUSE_CODE</th>\n",
       "      <th>STAT_CAUSE_DESCR</th>\n",
       "      <th>FIRE_SIZE</th>\n",
       "      <th>LATITUDE</th>\n",
       "      <th>LONGITUDE</th>\n",
       "      <th>STATE</th>\n",
       "      <th>COUNTY</th>\n",
       "      <th>FIPS_NAME</th>\n",
       "      <th>DISCOVERY_DATE</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>combined_date_dis</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2005-02-02</th>\n",
       "      <td>2005</td>\n",
       "      <td>33</td>\n",
       "      <td>1300</td>\n",
       "      <td>33.0</td>\n",
       "      <td>1730</td>\n",
       "      <td>9.0</td>\n",
       "      <td>Miscellaneous</td>\n",
       "      <td>0.10</td>\n",
       "      <td>40.036944</td>\n",
       "      <td>-121.005833</td>\n",
       "      <td>CA</td>\n",
       "      <td>63</td>\n",
       "      <td>Plumas</td>\n",
       "      <td>2453403.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004-05-12</th>\n",
       "      <td>2004</td>\n",
       "      <td>133</td>\n",
       "      <td>0845</td>\n",
       "      <td>133.0</td>\n",
       "      <td>1530</td>\n",
       "      <td>1.0</td>\n",
       "      <td>Lightning</td>\n",
       "      <td>0.25</td>\n",
       "      <td>38.933056</td>\n",
       "      <td>-120.404444</td>\n",
       "      <td>CA</td>\n",
       "      <td>61</td>\n",
       "      <td>Placer</td>\n",
       "      <td>2453137.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004-05-31</th>\n",
       "      <td>2004</td>\n",
       "      <td>152</td>\n",
       "      <td>1921</td>\n",
       "      <td>152.0</td>\n",
       "      <td>2024</td>\n",
       "      <td>5.0</td>\n",
       "      <td>Debris Burning</td>\n",
       "      <td>0.10</td>\n",
       "      <td>38.984167</td>\n",
       "      <td>-120.735556</td>\n",
       "      <td>CA</td>\n",
       "      <td>17</td>\n",
       "      <td>El Dorado</td>\n",
       "      <td>2453156.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004-06-28</th>\n",
       "      <td>2004</td>\n",
       "      <td>180</td>\n",
       "      <td>1600</td>\n",
       "      <td>185.0</td>\n",
       "      <td>1400</td>\n",
       "      <td>1.0</td>\n",
       "      <td>Lightning</td>\n",
       "      <td>0.10</td>\n",
       "      <td>38.559167</td>\n",
       "      <td>-119.913333</td>\n",
       "      <td>CA</td>\n",
       "      <td>3</td>\n",
       "      <td>Alpine</td>\n",
       "      <td>2453184.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2004-06-28</th>\n",
       "      <td>2004</td>\n",
       "      <td>180</td>\n",
       "      <td>1600</td>\n",
       "      <td>185.0</td>\n",
       "      <td>1200</td>\n",
       "      <td>1.0</td>\n",
       "      <td>Lightning</td>\n",
       "      <td>0.10</td>\n",
       "      <td>38.559167</td>\n",
       "      <td>-119.933056</td>\n",
       "      <td>CA</td>\n",
       "      <td>3</td>\n",
       "      <td>Alpine</td>\n",
       "      <td>2453184.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   FIRE_YEAR  DISCOVERY_DOY DISCOVERY_TIME  CONT_DOY CONT_TIME  STAT_CAUSE_CODE STAT_CAUSE_DESCR  FIRE_SIZE   LATITUDE   LONGITUDE STATE COUNTY  FIPS_NAME  DISCOVERY_DATE\n",
       "combined_date_dis                                                                                                                                                                         \n",
       "2005-02-02              2005             33           1300      33.0      1730              9.0    Miscellaneous       0.10  40.036944 -121.005833    CA     63     Plumas       2453403.5\n",
       "2004-05-12              2004            133           0845     133.0      1530              1.0        Lightning       0.25  38.933056 -120.404444    CA     61     Placer       2453137.5\n",
       "2004-05-31              2004            152           1921     152.0      2024              5.0   Debris Burning       0.10  38.984167 -120.735556    CA     17  El Dorado       2453156.5\n",
       "2004-06-28              2004            180           1600     185.0      1400              1.0        Lightning       0.10  38.559167 -119.913333    CA      3     Alpine       2453184.5\n",
       "2004-06-28              2004            180           1600     185.0      1200              1.0        Lightning       0.10  38.559167 -119.933056    CA      3     Alpine       2453184.5"
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_interest[\"combined_date_dis\"] = df_interest[\"FIRE_YEAR\"]*1000 + df_interest[\"DISCOVERY_DOY\"]\n",
    "df_interest[\"combined_date_dis\"] = pd.to_datetime(df_interest[\"combined_date_dis\"], format = \"%Y%j\")\n",
    "df_interest = df_interest.set_index(\"combined_date_dis\")\n",
    "df_interest.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "20c7f031",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "9f309efd",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "# Set up OpenAI API key\n",
    "openai.api_key = 'xxxxxxxxxxxxx'\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9bf09f5c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "6709d18f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Connect to the SQLite database\n",
    "# conn = sqlite3.connect('FPA_FOD_20170508.sqlite')\n",
    "# cursor = conn.cursor()\n",
    "# sql = \"select * from fires\"\n",
    "# df = pd.read_sql_query(sql, conn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "id": "e937ee33",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "def query_database(sql_query):\n",
    "    \"\"\"\n",
    "    Executes a SQL query against the SQLite database.\n",
    "    \"\"\"\n",
    "    return pd.read_sql_query(sql_query, cnx)\n",
    "\n",
    "def generate_sql_query(messages):\n",
    "    \"\"\"\n",
    "    Uses OpenAI's GPT-4 to generate a SQL query based on a natural language prompt.\n",
    "    \"\"\"\n",
    "    response = openai.ChatCompletion.create(\n",
    "      model=\"gpt-3.5-turbo\",\n",
    "      messages=messages\n",
    "    )\n",
    "    return response.choices[0].message['content'].strip()\n",
    "\n",
    "\n",
    "def run_tool(json_query):\n",
    "    \"\"\"\n",
    "    Uses OpenAI's GPT-4 to generate a SQL query based on a natural language prompt.\n",
    "    \"\"\"\n",
    "    if(json_query[\"tool_name\"] == \"Query_Database\"):\n",
    "        try:\n",
    "            df1 = query_database(json_query[\"command\"])\n",
    "            print(df1)\n",
    "            data = df1.head().to_dict(orient='records')  # Converts the DataFrame head to a list of dictionaries\n",
    "            return data\n",
    "        except:\n",
    "            print(\"Incorrect sql command. Trying again\")\n",
    "            return \"Retry SQL Query\"\n",
    "    if(json_query[\"tool_name\"] == \"Generate_Final_Answer\"):\n",
    "        return \"Finish\"\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "id": "18c20281",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "    \"tool_name\": \"Query_Database\",\n",
      "    \"command\": \"SELECT FIRE_YEAR, COUNT(*) AS NUM_WILDFIRES FROM fires GROUP BY FIRE_YEAR ORDER BY FIRE_YEAR;\"\n",
      "}\n",
      "{'tool_name': 'Query_Database', 'command': 'SELECT FIRE_YEAR, COUNT(*) AS NUM_WILDFIRES FROM fires GROUP BY FIRE_YEAR ORDER BY FIRE_YEAR;'}\n",
      "    FIRE_YEAR  NUM_WILDFIRES\n",
      "0        1992          67975\n",
      "1        1993          61989\n",
      "2        1994          75955\n",
      "3        1995          71472\n",
      "4        1996          75574\n",
      "5        1997          61450\n",
      "6        1998          68370\n",
      "7        1999          89363\n",
      "8        2000          96416\n",
      "9        2001          86587\n",
      "10       2002          75656\n",
      "11       2003          68261\n",
      "12       2004          69279\n",
      "13       2005          88604\n",
      "14       2006         114004\n",
      "15       2007          95573\n",
      "16       2008          85378\n",
      "17       2009          78325\n",
      "18       2010          79889\n",
      "19       2011          90552\n",
      "20       2012          72769\n",
      "21       2013          64780\n",
      "22       2014          67753\n",
      "23       2015          74491\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'{\\n    \"tool_name\": \"Generate_Final_Answer\",\\n    \"command\": \"Based on the data retrieved from the \\'fires\\' table, the number of wildfires has fluctuated over the years. For example, in 1992 there were 67,975 wildfires, while in 1994 there were 75,955 wildfires. This suggests that the frequency of wildfires has varied over time, and further analysis may be needed to determine any overall trend.\"\\n}'"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "\n",
    "\n",
    "columns = str(df.columns)\n",
    "memory = [columns]\n",
    "prompt = '''<s> [INST]You are an agent capable of using a variety of TOOLS to answer a data analytics question.\n",
    "Always use MEMORY to help select the TOOLS to be used. The name of the SQLlite table is fires.\n",
    " \n",
    "MEMORY\n",
    "The column names are \n",
    "'''\n",
    "prompt+= columns\n",
    "prompt+= '''\n",
    " \n",
    "TOOLS\n",
    "- Generate_Final_Answer: Use if answer to User's question can be given with MEMORY and data we have. Use this after thorough data analysis\n",
    "- Query_Database: Write only one SQL Query to query the Database. This can only execute one query at a time\n",
    " \n",
    "ANSWER FORMAT\n",
    "{\n",
    "    \"tool_name\": \"\"\"\n",
    "    \"command\": \"\"\"\n",
    "}\n",
    "[/INST]\n",
    "User:  Have wildfires become more or less frequent over time?\n",
    "Assistant: {\n",
    " \"tool_name\":\n",
    " \"command\":\n",
    "}\n",
    "''' \n",
    "messages=[\n",
    "          {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
    "          {\"role\": \"user\", \"content\": prompt}\n",
    "]\n",
    "# Execute the generated SQL query\n",
    "sql_query = generate_sql_query(messages)\n",
    "print(sql_query)\n",
    "print(json.loads(sql_query))\n",
    "json_query = json.loads(sql_query)\n",
    "\n",
    "data = run_tool(json_query)\n",
    "\n",
    "prompt+= sql_query+ \"\\n ''response:''\" + str(data) + \"}\\n\"\n",
    "\n",
    "messages=[\n",
    "          {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
    "          {\"role\": \"user\", \"content\": prompt}\n",
    "]\n",
    "# messages.append({\"role\":\"system\", \"content\": \"SQL data extracted\"})\n",
    "# messages.append({\"role\":\"user\", \"content\": \"Move to the next step as specified in the prompt\"})\n",
    "generate_sql_query(messages)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "669cd782",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "022d999e",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'str' object has no attribute 'read'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[0;32m/var/folders/3_/rjcfvfms1rg9v5hbwnyzwjpr0000gn/T/ipykernel_85188/3413821367.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0;31m# df1 = query_database(sql_query)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;31m# print(df1)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql_query\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py\u001b[0m in \u001b[0;36mload\u001b[0;34m(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[1;32m    291\u001b[0m     \u001b[0mkwarg\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0motherwise\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mJSONDecoder\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;31m`\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mused\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    292\u001b[0m     \"\"\"\n\u001b[0;32m--> 293\u001b[0;31m     return loads(fp.read(),\n\u001b[0m\u001b[1;32m    294\u001b[0m         \u001b[0mcls\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcls\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobject_hook\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mobject_hook\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    295\u001b[0m         \u001b[0mparse_float\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mparse_float\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparse_int\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mparse_int\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mAttributeError\u001b[0m: 'str' object has no attribute 'read'"
     ]
    }
   ],
   "source": [
    "# sql_query = '''SELECT COUNTY, COUNT(*) AS fire_count FROM fires GROUP BY COUNTY ORDER BY fire_count DESC LIMIT 1\\nUNION\\nSELECT COUNTY, COUNT(*) AS fire_count FROM fires GROUP BY COUNTY ORDER BY fire_count ASC LIMIT 1'''\n",
    "# # df1 = query_database(sql_query)\n",
    "# # print(df1)\n",
    "# print(json.load(sql_query))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "415b5150",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
